package com.lupus.util;

import java.security.*;
import java.util.UUID;

public class IdentityUtil {
	
	public static String getCurrentIdentity(){
		String uuid = UUID.randomUUID().toString();
		MessageDigest md5 = null;
		try{
			md5 = MessageDigest.getInstance("MD5");
		}catch(NoSuchAlgorithmException e){
			throw new RuntimeException(e);
		}
		byte[] byteArray = md5.digest(uuid.getBytes());
		int length = byteArray.length;
		StringBuilder hexString = new StringBuilder(length*2);
		for(int i=0;i<length;i++){
			hexString.append(Integer.toHexString((byteArray[i]&0xf0)>>4));
			hexString.append(Integer.toHexString((byteArray[i]&0x0f)));
		}
		return hexString.toString();
	}
}
